package main

import (
	"net/url"

	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/container"
	"fyne.io/fyne/v2/widget"
	"github.com/zhaocy/fyne-theme"
)

func main() {
	myApp := app.New()
	myApp.Settings().SetTheme(themex.Themex())
	myWin := myApp.NewWindow("hyperlink")

	h := widget.NewHyperlink("百度", nil)
	h.SetText("请点击")
	h.SetURLFromString("http://www.baidu.com")

	h2:= widget.NewHyperlink("CSDN",parseUrl("http://www.csdn.net"))
	myWin.SetContent(container.NewHBox(h,h2))
	myWin.Resize(fyne.NewSize(550, 450))
	myWin.ShowAndRun()
}

func parseUrl(str string)*url.URL{
	u, err := url.Parse(str)
	if err!=nil{
		fyne.LogError("url parse err:",err)
	}
	return u
}